package com.project.ServiceImp;

import com.alibaba.dubbo.config.annotation.Service;
import com.project.mapper.JiuzhenDao;
import gz.JiuzhenService;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


@Service(interfaceClass = JiuzhenService.class)
@Component
@Transactional
public class JiuzhenServiceImp implements JiuzhenService {

    @Resource
    private JiuzhenDao jd;


    /**
     * 查询出未就诊的所有患者且根据姓名模糊查询
     * @param name
     * @return
     */
    @Override
    public List<Map<String, Object>> findAll(String name) {
        Map<String,Object> map = new HashMap<>();
        map.put("name",name);
        return jd.findAll(map);
    }


    /**
     * 查询出已就诊的所有患者且根据姓名模糊查询
     * @param names
     * @return
     */
    @Override
    public List<Map<String, Object>> findAlls(String names) {
        Map<String,Object> map = new HashMap<>();
        map.put("names",names);
        return jd.findAlls(map);
    }


    /**
     * 根据前端传过来的值修改患者状态
     * @param id
     * @param status
     * @return
     */
    @Override
    public int updateIdStatus(Integer id, Integer status) {
        Map<String,Object> map = new HashMap<>();
        map.put("id",id);
        map.put("status",status);
        int i = jd.updateIdStatus(map);
        return i;
    }


}
